#ifndef MYCMD_H
#define MYCMD_H
#include"funs.h"
#include <QMainWindow>
#include "common.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MyCMD; }
QT_END_NAMESPACE

class MyCMD : public QMainWindow
{
    Q_OBJECT

public:
    MyCMD(QWidget *parent = nullptr);
    ~MyCMD();
    bool eventFilter(QObject *target, QEvent *event);//事件过滤器
    void clear(int flag);

    void send();

    void judge();

    void giveWin();

    //响应命令列表
    void chmod(int length,QVector<QString> command);
    void diskinfo(int length);
    void md5(int length,QVector<QString> command);
    void date(int length,QVector<QString> command);
    void cpu(int length);
    void memory(int length);

    void touch(int length,QVector<QString> command);        //新建文件
    void rm(int length,QVector<QString> command);           //删除文件
    //设置字体
    void setFont();






private slots:
    void setCursor();
    void readOutput();
    void on_textEdit_input_textChanged();

    void toBlackWrite();

    void toWhiteBlack();

    void on_action_I_triggered();

    void on_action_B_triggered();

    void on_action_gitee_triggered();

    void on_action_sognti_triggered();

    void on_action_heiti_triggered();

    void on_action_xingkai_triggered();

    void on_action_yellowBlack_triggered();

    void on_action8_triggered();

    void on_action12_triggered();

    void on_action10_triggered();

    void on_action16_triggered();

    void on_action20_triggered();

    void on_action9_triggered();

    void on_action11_triggered();

    void on_action13_triggered();

    void on_action14_triggered();

    void on_action15_triggered();

    void on_action_green_triggered();

    void on_action_kaiti_triggered();

    void on_action_author_triggered();

private:
    Ui::MyCMD *ui;
    QString welcome = "welcome to MyCMD V0.0.4";
    QVector<QString> command;
    QString lastCommand;        //为了实现退格键不会删到当前的目录名
    QString midedCommand;       //去掉目录路径后的当前命令
    QProcess * pro;
    QByteArray out;
    QString lastError;
    QString currentPath;        //管理当前目录
    int pathLength;

    //主题部分
    QString text_type;//当前字体
    int set_l;
    int set_B;
    int size;//字体大小

    //功能模块
    funs * fs;
};
#endif // MYCMD_H
